﻿using System;
using System.Globalization;
using System.Windows.Data;
using GpgApi;

namespace WgpgGUI
{
    [ValueConversion(typeof(KeyOwnerTrust), typeof(String))]
    public sealed class OwnerTrustToStringConverter : IValueConverter
    {
        public String Full { get; set; }
        public String Marginal { get; set; }
        public String None { get; set; }
        public String Ultimate { get; set; }

        public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
        {
            KeyOwnerTrust trust = (KeyOwnerTrust)value;

            switch (trust)
            {
                case KeyOwnerTrust.Ultimate:
                    return Ultimate;
                case KeyOwnerTrust.Full:
                    return Full;
                case KeyOwnerTrust.Marginal:
                    return Marginal;
                case KeyOwnerTrust.None:
                    return None;
                default:
                    return String.Empty;
            }
        }

        public Object ConvertBack(Object value, Type targetType, Object parameter, CultureInfo culture)
        {
            throw new NotSupportedException();
        }
    }
}
